<table class="table table-condensed table-hover">
<tbody>
    <tr>
        <th colspan="2" class="{{ {'C': 'success', 'A': 'danger'}[alarm.status] }}">
            {{ _("Alarm") }}: {{ subject }}
            {{ service_summary | glyph_summary }}
            <span style="float: right">
                {{ duration }}({{ timestamp | timestamp}})
            </span>
        </th>
    </tr>
    <tr>
        <th scope="row">{{ _("Class") }}</th>
        <td>{{ alarm.alarm_class.name }}</td>
    </tr>
    <tr>
        <th scope="row">{{ _("Severity") }}</th>
        <td>{{ severity.name }} ({{ alarm.severity }})</td>
    </tr>
    <tr>
        <th scope="row">{{ _("Object") }}</th>
        <td>
            <a href="/api/card/view/managedobject/{{ managed_object.id }}/">{{ managed_object | managed_object_title }}</a>
            ({{ managed_object.address }}, {{ managed_object.platform }})
            {{ managed_object | object_console }}
            {% if lon %}
            <a href="/api/card/view/alarmheat/0/?lon={{ lon }}&lat={{ lat }}&zoom={{ zoom }}" target="blank">
            <i class="fa fa-map" title="Heatmap"></i>
            </a>
            {% endif %}
        </td>
    </tr>
    <tr>
        <th scope="row" class="col-sm-1">{{ _("Location") }}</th>
        <td>
            {% for p in container_path %}
            {% if not loop.first %}&gt;{% endif %}
            {{ p.name }}
            {% endfor %}
        </td>
    </tr>
    <tr>
        <th scope="row">{{ _("Segment") }}</th>
        <td>
            <a href="/api/card/view/segment/{{ managed_object.segment.id }}/">{{ managed_object.segment.name }}</a>
        </td>
    </tr>
    <tr>
        <th scope="row">{{ _("Administrative Domain") }}</th>
        <td>{{ managed_object.administrative_domain.name }}</td>
    </tr>
    {% if alarm.escalation_tt %}
    <tr>
        <th scope="row">{{ _("Escalation") }}</th>
        <td>
            TT <a href="/api/card/view/tt/{{ alarm.escalation_tt }}/">{{ alarm.escalation_tt }}</a> ({{ alarm.escalation_ts | timestamp }})
        </td>
    </tr>
    {% endif %}
    {% if alarm.escalation_error %}
    <tr>
        <th scope="row">{{ _("Escalation Error") }}</th>
        <td>
            {{ alarm.escalation_error }}
        </td>
    </tr>
    {% else %}
        {% if tt_system_failed %}
        <tr>
            <th scope="row">{{ _("Escalation Error") }}</th>
            <td>
                {{ tt_system }}: {{ _("Temporary unavailable") }}
            </td>
        </tr>
        {% endif %}
    {% endif %}
    {% if escalation_ctx or escalation_close_ctx %}
    <tr>
        <th scope="row">{{ _("Escalation trace") }}</tr>
        <tr>
            {% if escalation_ctx %}
            <a href="/api/card/view/span/{{ escalation_ctx }}/">{{ _("Escalation trace") }}</a>
            {% endif %}
            {% if escalation_close_ctx %}
            <a href="/api/card/view/span/{{ escalation_close_ctx }}/">{{ _("Deescalation trace") }}</a>
            {% endif %}
        <tr>
    </tr>
    {% endif %}
    <tr>
        <th scope="row">{{ _("Body") }}</th>
        <td><pre>{{ body }}</pre></td>
    </tr>
    <tr>
        <th scope="row">{{ _("Symptoms") }}</th>
        <td><pre>{{ alarm.alarm_class.symptoms }}</pre></td>
    </tr>
    <tr>
        <th scope="row">{{ _("Probable Causes") }}</th>
        <td><pre>{{ alarm.alarm_class.probable_causes }}</pre></td>
    </tr>
    <tr>
        <th scope="row">{{ _("Recommended Actions") }}</th>
        <td><pre>{{ alarm.alarm_class.recommended_actions }}</pre></td>
    </tr>
    <tr>
        <th scope="row">{{ _("Alarms") }}</th>
        <td>
            <table class="table table-condensed">
                <thead>
                    <tr>
                        <th></th>
                        <th>{{ _("Timestamp") }}</th>
                        <th>{{ _("Services") }}</th>
                        <th>{{ _("Duration") }}</th>
                        <th>{{ _("Object") }}</th>
                        <th>{{ _("IP") }}</th>
                        <th>{{ _("Class") }}</th>
                        <th>{{ _("Subject") }}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for a in alarms %}
                    <tr>
                        <td>{% if a.id == alarm.id %}<i class="fa fa-arrow-right"></i>{% endif %}</td>
                        <td> {{ "".join(["&nbsp;&nbsp;&nbsp;&nbsp;"] * a._level) }}
                            <a href="/api/card/view/alarm/{{ a.id }}/">{{ a.timestamp | timestamp }}</a>
                        </td>
                        <td>
                            {{ a.service_summary | glyph_summary }}
                        </td>
                        <td>{{ a.display_duration }}</td>
                        <td><a href="/api/card/view/managedobject/{{ a.managed_object.id }}/">{{ a.managed_object | managed_object_title }}</a></td>
                        <td><a href="/api/card/view/managedobject/{{ a.managed_object.id }}/">{{ a.managed_object.address }}</a></td>
                        <td>{{ a.alarm_class.name }}</td>
                        <td>{{ a.subject }}</td>
                    </th>
                    {% endfor %}
                </tbody>
            </table>
        </td>
    </tr>
    {% if diagnostic %}
    <tr>
        <th scope="row">{{ _("Diagnostic") }}</th>
        <td>
            {% for d in diagnostic %}
                <div class="panel panel-default">
                    <div class="panel-heading">
                       {{ d["timestamp"] | timestamp }}
                    </div>
                    <div class="panel-body" style="white-space: pre-line">
                        {{ d["data"] | e }}
                    </div>
                </div>
            {% endfor %}
        </td>
    </tr>
    {% endif %}
    {% if log %}
    <tr>
        <th scope="row">{{ _("Log") }}</th>
        <td>
            {% for l in log %}
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <span class="pull-right">
                            ({{ l["timestamp"] | timestamp }})
                        </span>
                    </div>
                    <div class="panel-body" style="white-space: pre-line">
                        {{ l["message"] | e }}
                    </div>
                </div>
            {% endfor %}
        </td>
    </tr>
    {% endif %}
    {% if maintenance %}
    <tr>
        <th scope="row">{{ _("Maintenance") }}</th>
        <td>
            <table class="table table-condensed">
                <thead>
                <th scope="row">{{ _("Subject") }}</th>
                <th scope="row">{{ _("Type") }}</th>
                <th scope="row">{{ _("Date") }}</th>
                <th scope="row">{{ _("Contacts") }}</th>
                </thead>
                <tbody>
                {% for m in maintenance %}
                    <tr>
                        <td>{{ m.type.name }}</td>
                        <td><a href="/api/card/view/maintenance/{{ m.id }}/">{{ m.subject }}</a></td>
                        <td>{{ m.start }} - {{ m.stop }}</td>
                        <td>{{ m.contacts }}</td>
                    </tr
                {% endfor %}
                </tbody>
            </table>
        </td>
    </tr>
    {% endif %}
</tbody>
</table>